﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using CodeGeneratorHelper.Entities;
using CodeGeneratorHelper.DAL;

namespace CodeGeneratorHelper
{
    public static class XMLHelper
    {
        /*
        public static List<ClientInfo> GetClientsFromXML()
        {

            UIHelper.ChangeToCurrentDirectory();
            List<ClientInfo> oLstClientInfo = new List<ClientInfo>();

            XmlDocument xTimerSettingsDoc = new XmlDocument();
            xTimerSettingsDoc.Load("");

            XmlNodeList oClientsList = xTimerSettingsDoc.SelectNodes(@"/root/Client");
            foreach (XmlNode node in oClientsList)
            {
                string ClientCode = "AXCL" + node.Attributes["Code"].Value;
                if (ClientCode.Contains("ADMIN"))
                {
                    ClientCode = ClientCode.Replace("AXCL", "");
                }
                ClientInfo oClientInfo = PatientDal.GetClientByClientCode(ClientCode);
                if (null != oClientInfo)
                {
                    oClientInfo.XMLCode = ClientCode;
                    oClientInfo.XMLPracticeId = node.Attributes["PracticeId"].Value;
                    oClientInfo.XMLPracticeName = node.Attributes["PracticeName"].Value;
                    oClientInfo.FolderOnFTP = node.Attributes["FolderOnFTP"].Value;

                    oClientInfo.SftpUserId = node.Attributes["UserId"].Value;
                    oClientInfo.SftpUserPassword = node.Attributes["Password"].Value;
                    //oClientInfo.SftpUserPassword = node.Attributes["Email"].Value;
                    
                    oClientInfo.UploadAppointment = Convert.ToBoolean(node.Attributes["UploadAppointment"].Value);
                    oClientInfo.UploadPatient = Convert.ToBoolean(node.Attributes["UploadPatient"].Value);
                    oClientInfo.UploadInsurance = Convert.ToBoolean(node.Attributes["UploadInsurance"].Value);

                    oClientInfo.InitialLoad = Convert.ToBoolean(node.Attributes["InitialLoad"].Value);
                    if(null != node.Attributes["Location"])
                        oClientInfo.Location = node.Attributes["Location"].Value;

                    if (null != node.Attributes["IsProductionClient"])
                        oClientInfo.IsProductionClient = Convert.ToBoolean(node.Attributes["IsProductionClient"].Value);
                    else
                        oClientInfo.IsProductionClient = true;
                    
                    oLstClientInfo.Add(oClientInfo);
                }
            }
            return oLstClientInfo;
        }
        */
    }
}
